home *** CD-ROM | disk | FTP | other *** search
/ Star Festival... a Return to Japan / Star Festival... a Return to Japan.iso / pc / STARFESTIVAL / Shared.Cst / 00003_utils.ls < prev    next >
Encoding:
Text File  |  1999-10-10  |  4.7 KB  |  187 lines

  1. on initGlobals
  2.   global gKnobState    -- a number between 0 and 4 indicating PDA mode.
  3.   global gKnobLow      -- the castNumber representing the lowest knob inbetween
  4.   global gMemoState    -- the play/paused state of the video memo - 0 is play, 1 is paused
  5.   global gSearchFlag
  6.   
  7.   
  8.   set gSearchFlag = 0
  9.   set gMemoState = 0
  10.   -- Mode state: 0 is search, 1 is browse, 2 is map
  11.   set gKnobState = 1   
  12.   preloadCast "buttonSound"
  13. end initGlobals
  14. --
  15.  
  16. on setUpKnob
  17.   global gKnobSprite, gKnobLow
  18.   preloadCast "knobSound"
  19.   set gKnobLow = the number of cast "knob00"
  20.   -- channel must contain a sprite when puppet sprite is invoked, so
  21.   -- this is moved to knobSwitch
  22.   --puppetSprite gKnobSprite, true
  23. end setUpKnob
  24. --
  25.  
  26. on quickSwitch theSound
  27.   
  28.   -- assign the sprite channel where the mouse click occured
  29.   set channel = the clickOn
  30.   
  31.   -- make the sprite a puppet, contolled by this lingo
  32.   puppetsprite channel, true
  33.   
  34.   -- check to see if passed argument
  35.   if theSound <> "none" then
  36.     -- make the sound channel a puppet, overriding any sound in the 
  37.     --  sound channel of the score and play the arg castmember sound
  38.     puppetSound theSound
  39.   end if
  40.   
  41.   -- set the puppet to a cast member with the name of the puppet concat 'B'  
  42.   set theCast = the name of cast( the castNum of sprite channel )
  43.   set the castNum of sprite channel to (the number of cast(theCast & "B"))
  44.   updateStage
  45.   
  46.   --see global navswitch comment  
  47.   -- loop during the time sound plays in channel 1
  48.   --   repeat while soundBusy(1)
  49.   --   end repeat
  50.   --   stop sound from playing
  51.   --   puppetSound (0)
  52.   
  53.   -- ignore multiple mouse downs
  54.   repeat while the stilldown
  55.   end repeat
  56.   
  57.   -- reset the puppet to its original cast number
  58.   set the castNum of sprite channel to ( the number of cast theCast )
  59.   updateStage
  60.   
  61.   -- make the sprite a nonpuppet, contolled by the score
  62.   puppetsprite channel, false
  63.   
  64. end quickSwitch
  65.  
  66. ------------------------------------------------------------------------
  67.  
  68. on knobSwitch destMode
  69.   
  70.   global DEBUG
  71.   
  72.   global gKnobSprite, gKnobState, gknobLow
  73.   
  74.   --  sound stop 1
  75.   --  puppetsound 0
  76.   
  77.   preloadMember (member 72 of castLib "shared", member 84 of castLib "shared")
  78.   
  79.   --set upNumber = the mouseH
  80.   
  81.   --set downNumber = the mouseH
  82.   
  83.   -- flush mousedowns
  84.   repeat while the stilldown
  85.     nothing
  86.   end repeat
  87.   
  88.   if destMode = "none" then
  89.     set destMode = 1
  90.   end if
  91.   
  92.   puppetSprite gKnobSprite, true
  93.   if DEBUG then put "gKnobState:" gKnobState
  94.   
  95.   -- Search mode, must go to "greater" mode
  96.   if gKnobState = 0 then
  97.     --if downNumber >= upNumber then
  98.     set destNum = destMode * 4
  99.     puppetSound "knobSound"
  100.     updateStage
  101.     repeat with i = 0 to destnum
  102.       set the castNum of sprite gKnobSprite = (gKnobLow + i)
  103.       if DEBUG then put "gKnobLow+i:" (gKnobLow + i)
  104.       updateStage
  105.       clockWait .1
  106.     end repeat
  107.     
  108.     repeat while soundBusy(1)
  109.     end repeat
  110.     
  111.     set gKnobState = destMode
  112.     exit
  113.     --end if
  114.   end if
  115.   
  116.   -- Browse mode
  117.   if gKnobState = 1 then
  118.     -- going to "lesser" search mode
  119.     if destMode = 0 then
  120.       --if downNumber <= upNumber then
  121.       puppetSound "knobSound"
  122.       updateStage
  123.       repeat with i = 1 to 5
  124.         set the castNum of sprite gKnobSprite = ((gKnobLow + 5) - i)
  125.         if DEBUG then put "gKnobLow+5-i:" (gKnobLow + 5 - i)
  126.         updateStage
  127.         clockWait .1
  128.       end repeat
  129.       set gKnobState = 0
  130.       exit
  131.       --end if
  132.     end if
  133.     -- going to "greater" map mode
  134.     if destMode = 2 then
  135.       --if downNumber <= upNumber then
  136.       set destNum = destMode * 4
  137.       puppetSound "knobSound"
  138.       updateStage
  139.       repeat with i = 4 to destNum
  140.         set the castNum of sprite gKnobSprite = (gKnobLow + i)
  141.         if DEBUG then put "gKnobLow+i:" (gKnobLow + i)
  142.         updateStage
  143.         clockWait .1
  144.       end repeat
  145.       set gKnobState = 2
  146.       exit
  147.       --end if
  148.     end if
  149.   end if
  150.   
  151.   -- Map mode, must go to "lesser" mode
  152.   if gKnobState = 2 then
  153.     
  154.     if destMode = 0 then
  155.       
  156.       puppetSound "knobSound"
  157.       updateStage
  158.       repeat with i = 1 to 9
  159.         set the castNum of sprite gKnobSprite = ((gKnobLow + 9) - i)
  160.         if DEBUG then put "gKnobLow+5-i:" (gKnobLow + 5 - i)
  161.         updateStage
  162.         clockWait .1
  163.       end repeat
  164.       set gKnobState = 0
  165.       exit
  166.       
  167.     end if
  168.     
  169.     if destMode = 1 then
  170.       set destNum = destMode * 4
  171.       puppetSound "knobSound"
  172.       updateStage
  173.       repeat with i = 1 to destnum + 1
  174.         set the castNum of sprite gKnobSprite = ((gKnobLow + 9) - i)
  175.         if DEBUG then put "gKnobLow+9-i:" (gKnobLow + 9 - i)
  176.         updateStage
  177.         clockWait .1
  178.       end repeat
  179.       set gKnobState = 1
  180.       exit
  181.     end if
  182.   end if
  183.   
  184. end knobSwitch
  185.  
  186. ------------------------------------------------------------------------
  187.